using Microsoft.VisualStudio.Modeling;

namespace DslCrossModelFramework.NameResolution {
    public class DefaultModelElementNameResolver : ModelElementNameResolver<ModelElement> {

        public override string GetModelElementName(ModelElement modelElement) {
            if (modelElement.GetDomainClass().NameDomainProperty != null) {
                return modelElement.GetDomainClass().NameDomainProperty.GetValue(modelElement) as string;
            }

            return string.Format("{0} ({1})", modelElement.GetDomainClass().DisplayName, modelElement.Id);
        }
    }
}